package com.luo.chengrui.module.sa.dal.mysql.role;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.sa.dal.dataobject.role.RoleDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.sa.controller.admin.role.vo.*;

/**
 * 角色  Mapper
 *
 * @author 诚睿
 */
@Mapper
public interface RoleMapper extends BaseMapperX<RoleDO> {

    default PageResult<RoleDO> selectPage(RolePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RoleDO>()
                .eqIfPresent(RoleDO::getCode, reqVO.getCode())
                .likeIfPresent(RoleDO::getName, reqVO.getName())
                .eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RoleDO::getFolderId, reqVO.getFolderId())
                .orderByDesc(RoleDO::getId));
    }

    default List<RoleDO> selectList(RoleExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<RoleDO>()
                .eqIfPresent(RoleDO::getCode, reqVO.getCode())
                .likeIfPresent(RoleDO::getName, reqVO.getName())
                .eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RoleDO::getFolderId, reqVO.getFolderId())
                .orderByDesc(RoleDO::getId));
    }

}
